package controllers;

import models.Shoe;
import play.*;
import play.mvc.*;

import views.html.*;

public class Application extends Controller {

    public static Result GO_HOME = redirect(
        routes.Application.list(0, "name", "asc", "")
    );

    public static Result index() {
        return GO_HOME;
    }

    /**
     * Display the paginated list of computers.
     *
     * @param page Current page number (starts from 0)
     * @param sortBy Column to be sorted
     * @param order Sort order (either asc or desc)
     * @param filter Filter applied on computer names
     */
    public static Result list(int page, String sortBy, String order, String filter) {
        return ok(
                list.render(
                        Shoe.page(page, 10, sortBy, order, filter),
                        sortBy, order, filter
                )
        );
    }
}
